//package com.yuanfeng.job.job;
//
//
//import com.yuanfeng.commoms.util.DateUtils;
//import com.yuanfeng.job.mapper.AccountMapper;
//import org.quartz.JobExecutionContext;
//import org.quartz.JobExecutionException;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.List;
//
///**
// * @ClassName UpdateAccountStatusJob
// * @Description 达到截止还款日期未还更改账单状态
// * @Author liulh
// * @Date 2023/5/17 10:00
// * @Version 1.0
// **/
//public class UpdateAccountStatusJob implements BaseJob {
//
//    @Autowired
//    private AccountMapper accountMapper;
//
//    @Override
//    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
//        //查询逾期账单
//        List<String> list = accountMapper.getAccountByOverdue();
//        if (list != null && list.size() > 0) {
//            //更改账单状态为逾期
//            for (String s : list) {
//                accountMapper.updateAccountStatus(s);
//            }
//        }
//        //测试
//        SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd");
//        Date date = DateUtils.addDays(new Date(), 0);
//        String monthlyTime = df.format(DateUtils.dateBeginMouth(date)) + "~" + df.format(DateUtils.dateLongToDay(date,0,0));
//        accountMapper.updateAccountIsSue(monthlyTime);
////        Date repaymentDate = DateUtils.addDay(new Date(), -7);
////        String repaymentMonthlyTime = df.format(DateUtils.dateBeginMouth(repaymentDate)) + "~" + df.format(DateUtils.dateLongToDay(repaymentDate));
//        accountMapper.updateAccountIsRepayment(monthlyTime);
//        //判断时间是否是月初第一天
//        Boolean flag = DateUtils.isFirstDayOfMonth(new Date());
//        if (flag) {
////            SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd");
////            Date date = DateUtils.addDay(new Date(), -14);
////            String monthlyTime = df.format(DateUtils.dateBeginMouth(date)) + "~" + df.format(DateUtils.dateLongToDay(date));
//            //出具上月账单
////            accountMapper.updateAccountIsSue(monthlyTime);
//            //清除上月的回款金额
//            accountMapper.clearAccountMonthCollection();
//            //清除上月的使用金额
//            accountMapper.clearAccountMonthAmountUsed();
//            //让上上月的账单可以还款
////            Date repaymentDate = DateUtils.addDay(new Date(), -7);
////            repaymentDate = DateUtil.addMonth(new Date(), -1);
////            String repaymentMonthlyTime = df.format(DateUtils.dateBeginMouth(repaymentDate)) + "~" + df.format(DateUtils.dateLongToDay(repaymentDate));
////            accountMapper.updateAccountIsRepayment(repaymentMonthlyTime);
//        }
//    }
//
//}
